import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace AiAlarmApi {
  /** ai告警记录信息 */
  export interface AiAlarm {
    id: number; // 编号
    flowCode?: string; // 关联业务算法编号
    streamCode?: string; // 该报警数据所属报警摄像头的编号
    streamNickname: string; // 该报警数据所属报警摄像头的自定义名称
    alarmDesc: string; // 描述信息
    videoUrl: string; // 报警视频链接
    imageUrl?: string; // 报警图片链接
    alarmTime: string; // 报警发生时间,2024/09/24 16:18:10
    classId: number; // 目标id
    className?: string; // 目标名称
    typeName?: string; // 目标类型
    falseAlarm: number; // 误报：0否1是
  }
}

/** 查询ai告警记录分页 */
export function getAiAlarmPage(params: PageParam) {
  return requestClient.get<PageResult<AiAlarmApi.AiAlarm>>('/moxi/ai-alarm/page', { params });
}

/** 查询ai告警记录详情 */
export function getAiAlarm(id: number) {
  return requestClient.get<AiAlarmApi.AiAlarm>(`/moxi/ai-alarm/get?id=${id}`);
}

/** 新增ai告警记录 */
export function createAiAlarm(data: AiAlarmApi.AiAlarm) {
  return requestClient.post('/moxi/ai-alarm/create', data);
}

/** 修改ai告警记录 */
export function updateAiAlarm(data: AiAlarmApi.AiAlarm) {
  return requestClient.put('/moxi/ai-alarm/update', data);
}

/** 删除ai告警记录 */
export function deleteAiAlarm(id: number) {
  return requestClient.delete(`/moxi/ai-alarm/delete?id=${id}`);
}

/** 批量删除ai告警记录 */
export function deleteAiAlarmList(ids: number[]) {
  return requestClient.delete(`/moxi/ai-alarm/delete-list?ids=${ids.join(',')}`)
}

/** 导出ai告警记录 */
export function exportAiAlarm(params: any) {
  return requestClient.download('/moxi/ai-alarm/export-excel', params);
}
//误报
export function falseAlarm(data: AiAlarmApi.AiAlarm) {
    return requestClient.put('/moxi/ai-alarm/falseAlarm', data);
}

//ai算法分类
export function getSelectList() {
    return requestClient.get('/moxi/ai-type/list');
}
//获取误报分页内容
export function getFalseAlarmPage(params: PageParam) {
    return requestClient.get<any>('/moxi/ai-alarm/falseAlarmPage', { params });
}

